<?php

// 本类由系统自动生成，仅供测试用途
class IndexAction extends AdminBaseAction {

    public function index() {
        $back_nav = $menu = $this->_get_menu();
        unset($back_nav['dashboard']);
        $this->assign('menu', $menu);
        $this->assign('back_nav', $back_nav);
        $this->assign('menu_json', ecm_json_encode($menu));
        $this->display('ajs');
    }

    /*
     * 获取菜单数组
     */

    function _get_menu() {
        $menu = include('./' . APP_NAME . '/Common/menu.inc.php');

        return $menu;
    }

    public function getList() {
        import('@.ORG.Page');
        $model = M('Dome');
        $order = array();
        //sortFieldName排序字段/sort排序/sortImg排序图标/sortAlt排序提示/
        if (isset($_GET['order'])) {
            $order['order'] = $_GET['order'];
        } else {
            $order['order'] = 'id';
        }
        if (isset($_GET['sort'])) {
            $order['sort'] = $_GET['sort'];
        } else {
            $order['sort'] = 'desc';
        }
        $list = $model->order($order['order'] . ' ' . $order['sort'])->select();
        $param = array(
            'result' => $list, //分页用的数组或sql
            'listvar' => 'list', //分页循环变量
            'listRows' => 10, //每页记录数
            'parameter' => 'p='.$_GET['p'], //url分页后继续带的参数
            'target' => 'content', //ajax更新内容的容器id，不带#
            'pagesId' => 'page', //分页后页的容器id不带# target和pagesId同时定义才Ajax分页
            'template' => '_list', //ajax更新模板
            'order'=>$order,
        );
        $this->_page($param);
        $this->assign('count',count($list));
        $this->assign('tm',date("Y-m-d H:i:s"));
        $this->display();
    }

}